home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Singles Flirt Up Your Life! (German)
/
Singles Flirt Up Your Life.iso
/
data1.cab
/
Statemachine
/
boxingbag.lua
< prev
next >
Wrap
Text File
|
2004-01-29
|
1KB
|
44 lines
-- boxing bag state machine
beginStateMachine()
onMsg("buildMenu", function(msg)
if (repairMenu()) then return end
-- build the pie menu
clearPieMenu();
local button;
button = addPieMenuButton("pm_box", "box");
button.addDescription(ACTIVITY, "box");
-- button.addIcon("guiIconSpass");
end )
--
onMsg("box", function(msg)
-- get character who initiated this action
local character = getStateObjectFromID(msg.sender);
-- walk to the closest action point
local actionPoint = character.getClosestFreeActionPoint(character, this, {"box1", "box2", "box3"});
-- get the walk state object
local wso = character.walkSO;
if (actionPoint) then
if (wso.walkToActionPoint(actionPoint)) then
-- create state machine contexts
local wsoContext = StateMachineContext();
-- store the action point
wsoContext.storeData("actionPointName", actionPoint.getName());
wso.queueStateMachine("boxingbagChar.box", this, wsoContext);
else
print("no path found");
instantAbort(character, EMOTICON_NOPATH, "emoThink");
end
else
print("no action point found");
instantAbort(character, EMOTICON_CANNOT, "emoThink")
end
end )
endStateMachine()